//
//  TodayWeatherTableViewCell.m
//  fultureweather
//
//  Created by 王展 on 15/11/5.
//  Copyright © 2015年 wangzhan. All rights reserved.
//

#import "TodayWeatherTableViewCell.h"

@implementation TodayWeatherTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createTodayView];
    }
    return self;
}

-(void)createTodayView
{
    self.temperature_curr = [[UILabel alloc] initWithFrame:CGRectMake(15 * XWIDTH, 290 * XHIGHT, 250 * XWIDTH, 150 * XWIDTH)];
//    self.temperature_curr.backgroundColor = [UIColor redColor];
    self.temperature_curr.textColor = [UIColor whiteColor];
    self.temperature_curr.font = [UIFont fontWithName:@"HiraKakuProN-W3" size:70 * XWIDTH];
    [self.contentView addSubview:self.temperature_curr];
    
    self.weather = [[UILabel alloc] initWithFrame:CGRectMake(15 * XWIDTH, 290 *  XHIGHT, 150 * XWIDTH, 40 * XHIGHT)];
//    self.weather.backgroundColor = [UIColor redColor];
    self.weather.textColor = [UIColor whiteColor];
    self.weather.font = [UIFont fontWithName:@"HiraKakuProN-W3" size:20 * XWIDTH];
    [self.contentView addSubview:self.weather];
    
    
    self.temperature = [[UILabel alloc] initWithFrame:CGRectMake(15 * XWIDTH, 400 * XHIGHT, 150 * XWIDTH, 40 * XHIGHT)];
//    self.temperature.backgroundColor = [UIColor redColor];
    self.temperature.textColor = [UIColor whiteColor];
    self.temperature.font = [UIFont fontWithName:@"HiraKakuProN-W3" size:20 * XWIDTH];
    [self.contentView addSubview:self.temperature];
    
    self.wind = [[UILabel alloc] initWithFrame:CGRectMake(15 * XWIDTH, 430 * XHIGHT, 75 * XWIDTH, 40 * XHIGHT)];
//    self.wind.backgroundColor = [UIColor redColor];
    self.wind.textColor = [UIColor whiteColor];
    self.wind.font = [UIFont fontWithName:@"HiraKakuProN-W3" size:20 * XWIDTH];
    [self.contentView addSubview:self.wind];
    
    self.winp = [[UILabel alloc] initWithFrame:CGRectMake(85 * XWIDTH, 430 * XHIGHT, 75 * XWIDTH, 40 * XHIGHT)];
//    self.winp.backgroundColor = [UIColor redColor];
    self.winp.textColor = [UIColor whiteColor];
    self.winp.font = [UIFont fontWithName:@"HiraKakuProN-W3" size:20 * XWIDTH];
    [self.contentView addSubview:self.winp];
    
    self.humidity = [[UILabel alloc] initWithFrame:CGRectMake(15 * XWIDTH, 460 * XHIGHT, 150 * XWIDTH, 40 * XHIGHT)];
//    self.humidity.backgroundColor = [UIColor redColor];
    self.humidity.textColor = [UIColor whiteColor];
    self.humidity.font = [UIFont fontWithName:@"HiraKakuProN-W3" size:20 * XWIDTH];
    [self.contentView addSubview:self.humidity];

}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.backgroundColor = [UIColor clearColor];
}

-(void)setToday:(Today *)today
{
    _today = today;
    self.temperature_curr.text = self.today.temperature_curr;
    self.weather.text = self.today.weather;
    self.temperature.text = self.today.temperature;
    self.wind.text = self.today.wind;
    self.winp.text = self.today.winp;
    self.humidity.text = [NSString stringWithFormat:@"湿度: %@",self.today.humidity];
}

@end
